<?php

$vendorDir = dirname(dirname(__DIR__)) . '/vendor';
date_default_timezone_set('PRC');

return [
    'vendorPath' => $vendorDir,
    'extensions' => array_merge(
            require($vendorDir . '/yiisoft/extensions.php'), require(__DIR__ . '/extensions.php')
    ),
    'language' => 'zh-cn',
    'aliases' => [
        '@img' => dirname(dirname(__DIR__)) . '/img',
        '@temp' => dirname(dirname(__DIR__)) . '/temp',
    ],
    'components' => [
        'assetManager' => [
//            'converter' => [
//                'class' => 'yii\web\AssetConverter',
//                'commands' => [
//                    'less' => ['css', 'lessc {from} {to} --no-color'],
//                    'ts' => ['js', 'tsc --out {to} {from}'],
//                ],
//            ],
        ],
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=lmd_v1',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'ecs_',
            'enableSchemaCache' => true,
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
                //订单日志记录
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['info'],
                    'categories' => ['orders'],
                    'logFile' => '@app/runtime/logs/Orders/requests.log',
                    'maxFileSize' => 1024 * 2,
                    'maxLogFiles' => 20,
                ],
                //队列日志记录
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['info'],
                    'categories' => ['queue'],
                    'logFile' => '@app/runtime/logs/Queue/notification.log',
                    'maxFileSize' => 1024 * 2,
                    'maxLogFiles' => 50,
                ],
            ],
        ],
        'mail' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            //'useFileTransport' => true, //放在本地的邮件列表,测试邮件的时候可以开启这个
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.qq.com',
                'username' => 'xychen2008',
                'password' => '05291985.110',
                'port' => '465',
                'encryption' => 'ssl',
            ],
        ],
    ],
];
